<template>
  <div id="centerRight">
    <div class="bg-color-black">
      <div class="d-flex jc-center body-box dv-scr-board" ref="dvScolBoard">
        <dv-scroll-board :config="config"/>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "CenterUpListData",
  props: {
    dataList: {
      type: Array,
      default: () => {
        return []
      }
    },
    centerUpBoxHeight: {
      type: Number,
      default: 0,
    }
  },
  data() {
    return {
      config: {
        header: ['报名人', '报名时间', '邀请人'],
        data: [],
        //表格行数
        rowNum: 8,
        headerHeight: 45,
        //表头
        headerBGC: '#143168',
        //奇数行
        oddRowBGC: '#143168',
        //偶数行
        evenRowBGC: '#091446',
        align: ['center','center','center'],
        waitTime: 5000,
        carousel:'single'
      }
    }
  },
  watch: {
    centerUpBoxHeight: {
      handler(val) {
        this.$refs.dvScolBoard.style.height = (this.centerUpBoxHeight - 388) + 'px';
      }
    }
  },
  mounted() {
    this.$refs.dvScolBoard.style.height = (this.centerUpBoxHeight - 388) + 'px';
    this.formatDataList();
  },
  methods: {
    formatDataList() {
      this.config.data = [];
      if (this.dataList) {
        for (let i = 0; i < this.dataList.length; i++) {
          const itemList = [];
          itemList.push(this.dataList[i].enrollName)
          itemList.push(this.dataList[i].createTime)
          itemList.push(this.dataList[i].shareNickname)
          this.config.data.push(itemList);
        }
      }
    }
  }
}
</script>

<style scoped lang="scss">
#centerRight {
  padding: 20px;
  border-radius: 5px;
  .bg-color-black {
    height: 100%;
    border-radius: 10px;
  }
  .title {
    text-align: center;
    padding: 5px 0;
  }
  .text {
    color: #55c7ff;
    font-weight: bold;
    text-align: center;
  }
  .body-box {
    border-radius: 10px;
    overflow: hidden;
    .dv-scr-board {
      width: 100%;
    }
  }
}
</style>
